package com.fun.demo;

public class BitClac {
    public static void main(String[] args) {
        BitClac bitClac = new BitClac();

   //     bitClac.declare();
        
        bitClac.bitClac();

    }

    void declare(){
        int a = 0b111;   //二进制
        int b = 0111;    //八进制
        int c = 111;     //十进制
        int d = 0x111;   //十六进制
        System.out.println("a："+a);
        System.out.println("b："+b);
        System.out.println("c："+c);
        System.out.println("d："+d);
    }

    void bitClac(){
        // 1 2 4 8 16 32 64 128
        for (int i = 0; i < 16; i++) {
            int o = 15 & (i + 1);
            System.out.println("15 & " + (i + 1) + " : " + o);
        }
        System.out.println(31 & 15);
        System.out.println(31 & 16);
    }
}
